
using UnityEngine;


public class 分享截图大小 : 微信按钮
{
    public (int, int, int, int) Get分享截图大小()
    {
        (int, int, int, int) res=(0,0,0,0);
        var size = 微信需要的坐标;
        var 长宽比 = (size.Item3 + 0f) / size.Item4;
        if (长宽比 <= (5f / 4f))
        {
            //以宽为尊
            float 以高为尊的宽 = size.Item3 / (5f / 4f);
            float item2 = size.Item2 + 以高为尊的宽 / 2f;
            
            res = ( size.Item1, size.Item2, size.Item3, (int)size.Item4);
        }
        else
        {
            float 以高为尊的宽 = size.Item4 * (5f / 4f);
            float 额外 = (size.Item3 - 以高为尊的宽) / 2f;
            float item1 = size.Item1 + 额外;

            res = ((int) item1, size.Item2, (int) 以高为尊的宽, size.Item4);
        }

        return res;
    }

    protected override void 计算坐标()
    {
        base.计算坐标();
        var 截图 = Get分享截图大小();
        guiRect = new Rect(截图.Item1, 截图.Item2, 截图.Item3, 截图.Item4);
    }
}
